import request from '@/utils/request'

// 创建分类
export function createClassification(data) {
  return request({
    url: '/ems/classification/create',
    method: 'post',
    data: data
  })
}

// 更新分类
export function updateClassification(data) {
  return request({
    url: '/ems/classification/update',
    method: 'put',
    data: data
  })
}

// 删除分类
export function deleteClassification(id) {
  return request({
    url: '/ems/classification/delete?id=' + id,
    method: 'delete'
  })
}

// 获得分类
export function getClassification(id) {
  return request({
    url: '/ems/classification/get?id=' + id,
    method: 'get'
  })
}

// 获得分类分页
export function getClassificationPage(query) {
  return request({
    url: '/ems/classification/page',
    method: 'get',
    params: query
  })
}

// 导出分类 Excel
export function exportClassificationExcel(query) {
  return request({
    url: '/ems/classification/export-excel',
    method: 'get',
    params: query,
    responseType: 'blob'
  })
}
export function listClassification(query) {
  return request({
    url: '/ems/classification/list',
    method: 'get',
    params: query
  })
}

// 获取精简信息列表
export function listSimpleClassifications() {
  return request({
    url: 'ems/classification/list-all-simple',
    method: 'get'
  })
}